package done.easy_701_800;

import lombok.extern.slf4j.Slf4j;
import org.junit.Test;

/**
 * 744. Find Smallest Letter Greater Than Target 寻找比目标字母大的最小字母
 * <p>
 * 给定一个只包含小写字母的有序数组letters 和一个目标字母 target，寻找有序数组里面比目标字母大的最小字母。
 * 数组里字母的顺序是循环的。举个例子，如果目标字母target = 'z' 并且有序数组为 letters = ['a', 'b']，则答案返回 'a'。
 * <p>
 * 示例:
 * 输入:
 * letters = ["c", "f", "j"]
 * target = "a"
 * 输出: "c"
 * <p>
 * 输入:
 * letters = ["c", "f", "j"]
 * target = "c"
 * 输出: "f"
 *
 * @author 大硕
 * 2019-03-30 8:16 AM
 **/
@Slf4j
public class FindSmallestLetterGreaterThanTarget {

    @SuppressWarnings("all")
    public char nextGreatestLetter(char[] letters, char target) {
        //190330 first
        return 0;
    }

    @Test
    public void test() {
        char[] letters = new char[]{'c', 'f', 'j'};
        char target = 'z';
        log.info("result:{}", nextGreatestLetter(letters, target));
    }
}




























/*
public char nextGreatestLetter(char[] letters, char target) {
    for (int i = 0; i < letters.length - 1; i++) {
        if (letters[i] > target)
            return letters[i];
    }

    // 比目标字母大的 最小字母
    if (letters[letters.length - 1] <= target)
        return letters[0];
    else
        return letters[letters.length - 1];
}
*/
